﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using ITProject.Domain.Entities;
using ITProject.Domain;
using System.Web.Mvc;

namespace ITProject.WebUI.Models.ProjectAdmin
{
    public class ProjectAdminProjectReleaseViewModel
    {
        public string Name { get; set; }
        public string ReleaseStatus { get; set; }

        public static ProjectAdminProjectReleaseViewModel[] Convert(Release[] releases)
        {
            ProjectAdminProjectReleaseViewModel[] vm = new ProjectAdminProjectReleaseViewModel[releases.Length];
            for (int i = 0; i < releases.Length; i++)
            {
                vm[i] = new ProjectAdminProjectReleaseViewModel();
                vm[i].Name = releases[i].Name;
                string releaseStatus = StatusName.ConvertFromByte(releases[i].Status);
                vm[i].ReleaseStatus = releaseStatus;
            }
            return vm;
        }
    }
}